package com.lanou3g.demo.entity;


import com.lanou3g.demo.validate.LoginValidate;
import com.lanou3g.demo.validate.ModifyPwValidate;
import com.lanou3g.demo.validate.ModifyUserInfo;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

public class AdminInfo {

    private long adminId;
    @NotBlank(message = "账户不能为空", groups = {LoginValidate.class})
    private String adminCode;
    @NotBlank(message = "密码不能为空", groups = {LoginValidate.class, ModifyPwValidate.class})
    @Length(min = 6, max = 30, message = "密码长度只能在6~30字符之间")
    private String password;
    @NotBlank(message = "新密码不能为空", groups = {ModifyPwValidate.class})
    @Length(min = 6, max = 30, message = "密码长度只能在6~30字符之间")
    private String newPassword;
    @NotBlank(message = "用户名不能为空", groups = {ModifyUserInfo.class})
    @Length(min = 2, max = 20, message = "用户名长度只能在2~20字符之间")
    private String name;
    @NotBlank(message = "电话不能为空", groups = {ModifyUserInfo.class})
    @Pattern(regexp = "^1([34578])\\d{9}$", message = "电话格式不正确", groups = {ModifyUserInfo.class})
    private String telephone;
    @NotBlank(message = "邮箱不能为空", groups = {ModifyUserInfo.class})
    @Email(message = "邮箱格式不正确", groups = {ModifyUserInfo.class})
    private String email;
    private java.sql.Timestamp enrolldate;

    private AdminRole adminRole;

    public AdminInfo() {
    }


    @Override
    public String toString() {
        return "AdminInfo{" +
                "adminId=" + adminId +
                ", adminCode='" + adminCode + '\'' +
                ", password='" + password + '\'' +
                ", newPassword='" + newPassword + '\'' +
                ", name='" + name + '\'' +
                ", telephone='" + telephone + '\'' +
                ", email='" + email + '\'' +
                ", enrolldate=" + enrolldate +
                ", adminRole=" + adminRole +
                '}';
    }

    public AdminRole getAdminRole() {
        return adminRole;
    }

    public void setAdminRole(AdminRole adminRole) {
        this.adminRole = adminRole;
    }

    public String getNewPassword() {
        return newPassword;
    }

    public void setNewPassword(String newPassword) {
        this.newPassword = newPassword;
    }

    public long getAdminId() {
        return adminId;
    }

    public void setAdminId(long adminId) {
        this.adminId = adminId;
    }


    public String getAdminCode() {
        return adminCode;
    }

    public void setAdminCode(String adminCode) {
        this.adminCode = adminCode;
    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }


    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }


    public java.sql.Timestamp getEnrolldate() {
        return enrolldate;
    }

    public void setEnrolldate(java.sql.Timestamp enrolldate) {
        this.enrolldate = enrolldate;
    }

}
